<template>
  <section class="menu_right" v-if="activeIndex === index">
    <!-- 标题 -->
    <header class="menu_detail_header">
      <div class="menu_detail_header_left">
        <strong class="menu_item_title">{{list.name}}</strong>
        <span class="menu_item_description"> {{list.description}}</span>
      </div>
      <span class="menu_detail_header_right" @click="ChangeState"></span>
    </header>
    <!-- 右侧按钮-->
    <div class="description_tipCo">
      <p class="description_tip" v-if="check">
        <span>{{list.name}}</span>
        {{list.description}}
      </p>
    </div>
    <!-- 食品名称 -->
    <Footer v-for="(i,j) in list.foods" :key="j" :foodsList="i"></Footer>
  </section>
</template>

<script>
import Footer from '@/views/Details/Footer/Footer.vue'
export default {
  components: {
    Footer
  },
  props: {
    list: {
      type: Object,
      default: {}
    },
    // 索引
    index: {
      type: Number,
      default: 0
    },
    // 左侧分类的索相
    activeIndex: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      //菜单栏状态
      check: false
    }
  },
  methods: {
    ChangeState() {
      if (this.check === false) {
        this.check = true
      } else {
        this.check = false
      }
    }
  }
}
</script>

<style lang="less" scoped>
.menu_right {
  overflow-y: auto;
  .menu_detail_header {
    width: 100%;
    padding: 0.4rem;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .menu_detail_header_left {
      width: 11rem;
      white-space: nowrap;
      overflow: hidden;
      .menu_item_title {
        font-size: 0.7rem;
        color: #666;
        font-weight: 700;
      }
      .menu_item_description {
        font-size: 0.5rem;
        color: #999;
        width: 30%;
        overflow: hidden;
      }
    }
    .menu_detail_header_right {
      width: 0.5rem;
      height: 1rem;
      display: block;
      background-image: url('@/assets/img/xiangqing.png');
      background-repeat: no-repeat;
      background-size: 100% 0.4rem;
      background-position: 0;
    }
  }
}
.description_tip {
  background-color: #39373a;
  opacity: 0.95;
  font-size: 0.5rem;
  color: #fff;
  position: absolute;
  top: 1.5rem;
  z-index: 999;
  width: 8rem;
  right: 0.2rem;
  padding: 0.5rem 0.4rem;
  border: 1px;
  border-radius: 0.2rem;
  > span {
    line-height: 0.6rem;
    font-size: 0.55rem;
  }
}
.description_tip:after {
  content: '';
  position: absolute;
  width: 0.4rem;
  height: 0.4rem;
  background-color: #39373a;
  top: -0.5rem;
  right: 0.7rem;
  transform: rotate(-45deg) translateY(0.41rem);
}
</style>